﻿using System.Globalization;
using System.Text.RegularExpressions;
using StackOverflowNotifier2;

namespace StackOverflowClient
{
    public class Parser
    {
    	// TODO: this is a temporary class until the new Notifier release
        public static UserDescriptor Parse(string s)
        {
        	var parser = new Parser2();
        	
            var user = new UserDescriptor();

            user.Name = parser.ParseName(s);
            user.Reputation = parser.ParseReputation(s);
            user.NumberOfBronzeBadges = parser.ParseBandgeCount(s, Parser2.BadgeType.Bronze);
            user.NumberOfSilverBadges = parser.ParseBandgeCount(s, Parser2.BadgeType.Silver);
            user.NumberOfGoldBadges = parser.ParseBandgeCount(s, Parser2.BadgeType.Gold);

            user.Image = parser.ParseImage(s);

            return user;
        }

        private static void ParseUserQuestions(string s)
        {
            int index = s.IndexOf("\"question-summary narrow\"");
            while(index > 0)
            {
            	
            	
            	index = s.IndexOf("\"question-summary narrow\"", index + 1);
            }
        }
    }
}
